package com.abc.robot01.rn

import android.content.Intent
import android.os.Bundle
import com.abc.robot01.activity.BaseActivity
import com.abc.robot01.activity.SysMessageActivity
import com.abc.robot01.activity.startActivity
import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate

class WaitingActivity : ReactActivity() {

    fun gotoSysMessageActivity() {
        this.startActivity<SysMessageActivity> {
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
        }
    }

    private fun gotoHome() {
        startActivity<BaseActivity>() {
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
        }
        finish()
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(null)
    }

    /**
     * Returns the name of the main component registered from JavaScript. This is used to schedule
     * rendering of the component.
     */
    override fun getMainComponentName(): String = "Robot11"

    /**
     * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
     * which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
     */
    override fun createReactActivityDelegate(): ReactActivityDelegate =
        DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
}
